package cn.xej.easyexcel.common;

import com.alibaba.excel.EasyExcel;

import java.io.OutputStream;
import java.util.List;

/**
 * @author <a href="mailto:enjie.xu@yunhutech.com">xiaoming</a>
 * @since 2021/6/8
 */
public class ExcelWriter {
    public static void writeExcel(OutputStream outputStream, Class<?> clazz, String sheetName, List<?> data) {
        writeExcel(outputStream, clazz, sheetName, null, null, data);
    }

    public static void writeExcel(OutputStream outputStream, Class<?> clazz, String sheetName, List<List<String>> head, List<String> excludeColumnFiled, List<?> data) {
//
        String fileName = System.currentTimeMillis()+".xlsx";
        EasyExcel.write(fileName, clazz).sheet(sheetName).doWrite(data);
        /**
        ExcelWriterBuilder builder = EasyExcel.write(outputStream, clazz).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy());
        builder.autoCloseStream(Boolean.TRUE);
        if (head != null) {
            builder.head(head);
        }
        if (excludeColumnFiled != null) {
            builder.excludeColumnFiledNames(excludeColumnFiled);
        }
        builder.sheet(sheetName).doWrite(data);
         */
    }
}
